package com.spdzen.support;

import org.apache.commons.lang3.StringUtils;

public class ValidateUtils {
	public static boolean rangeLength(String text, int minLen, int maxLen) {
		if (StringUtils.isBlank(text)) {
			return false;
		}
		
		if(minLen < 0){
			minLen = 0;
		}
		
		if(maxLen < 0){
			maxLen = 0;
		}
		
		if(maxLen < minLen){
			maxLen = minLen;
		}
		
		int len = text.length();
		
		return (len >= minLen) && (len <= maxLen);
	}
	
	public static boolean positiveLong(Long num) {
		return num != null && num.longValue() > 0L;
	}
	
	public static boolean positiveInteger(Integer num) {
		return num != null && num.intValue() > 0;
	}
}
